package my.state.headfirst.good;

//没有投币状态
public class NoQuarterState  implements State {

    //transient 修饰是 proxy 模式中加入的改进
    transient private GunballMachine gunballMachine;

    public NoQuarterState(GunballMachine gunballMachine){
        this.gunballMachine = gunballMachine;
    }

    @Override
    public void insertQuarter() {
        gunballMachine.setState(gunballMachine.getHasQuarterState());
        System.out.println("亲，收到一枚硬币");
    }

    @Override
    public void ejectQuarter() {
        System.out.println("亲，还没有投硬币呀！");
    }

    @Override
    public void turnCrank() {
        System.out.println("亲，还没有投硬币呀！");
    }

    @Override
    public void dispense() {
        System.out.println("错误操作");
    }
}
